import type { RouteRecordRaw } from 'vue-router'
import { DefaultRouterName } from './global'

export interface IMenuMap {
  label: string
  value: string
  component: any
}

/**
 * 菜单name枚举
 */
export enum ENUM_MENU_NAME_SYS {
  '用户管理' = 'userMgr',
  '角色管理' = 'roleMgr',
  '权限管理' = 'authMgr',
  '组织管理' = 'orgMgr',
  '组织类型' = 'orgType',
  '字典管理' = 'dicMgr'
}
export enum ENUM_MENU_NAME_FILE {
  '文件渠道' = 'fileChannel',
  '文件审核' = 'fileCheck',
  '文件配置' = 'fileConfig'
}
export enum ENUM_MENU_NAME_SCORE {
  '积分审核' = 'scoreCheck',
  '积分来源类型' = 'scoreType'
}
export enum ENUM_MENU_NAME_TASK {
  '调度日志' = 'dispathLog',
  '任务管理' = 'taskMgr',
  '执行器管理' = 'executeMgr'
}

/**
 * 菜单文件映射
 * 用于菜单管理中选择页面文件
 */
export const MENU_FILE_MAP: IMenuMap[] = [
  { label: '首页', value: DefaultRouterName, component: () => import('@/views/home/index.vue') },
  { label: '用户管理', value: ENUM_MENU_NAME_SYS['用户管理'], component: () => import('@/views/sys/userMgr.vue') },
  { label: '角色管理', value: ENUM_MENU_NAME_SYS['角色管理'], component: () => import('@/views/sys/roleMgr.vue') },
  { label: '权限管理', value: ENUM_MENU_NAME_SYS['权限管理'], component: () => import('@/views/sys/authMgr.vue') },
  { label: '组织管理', value: ENUM_MENU_NAME_SYS['组织管理'], component: () => import('@/views/sys/orgMgr.vue') },
  { label: '组织类型', value: ENUM_MENU_NAME_SYS['组织类型'], component: () => import('@/views/sys/orgTypeMgr.vue') },
  { label: '字典管理', value: ENUM_MENU_NAME_SYS['字典管理'], component: () => import('@/views/sys/dictMgr.vue') },

  { label: '文件审核', value: ENUM_MENU_NAME_FILE['文件审核'], component: () => import('@/views/file/fileCheck.vue') },
  { label: '文件渠道', value: ENUM_MENU_NAME_FILE['文件渠道'], component: () => import('@/views/file/fileChannel.vue') },
  { label: '文件配置', value: ENUM_MENU_NAME_FILE['文件配置'], component: () => import('@/views/file/fileConfig.vue') },

  { label: '积分审核', value: ENUM_MENU_NAME_SCORE['积分审核'], component: () => import('@/views/score/scoreCheck.vue') },
  { label: '积分来源类型', value: ENUM_MENU_NAME_SCORE['积分来源类型'], component: () => import('@/views/score/scoreType.vue') },

  { label: '任务管理', value: ENUM_MENU_NAME_TASK['任务管理'], component: () => import('@/views/task/taskMgr.vue') },
  { label: '任务执行器管理', value: ENUM_MENU_NAME_TASK['执行器管理'], component: () => import('@/views/task/executeMgr.vue') },
  { label: '任务调度日志', value: ENUM_MENU_NAME_TASK['调度日志'], component: () => import('@/views/task/dispatchLog.vue') }
]

/**
 * 静态页面-测试用
 */
export const MenuList: RouteRecordRaw[] = [
  {
    path: 'home',
    name: DefaultRouterName,
    meta: {
      label: '首页'
    },
    component: () => import('@/views/home/index.vue')
  },
  {
    path: 'sys',
    meta: { label: '系统管理' },
    children: [
      {
        path: 'user',
        name: ENUM_MENU_NAME_SYS['用户管理'],
        meta: { label: '用户管理' },
        component: () => import('@/views/sys/userMgr.vue')
      },
      {
        path: 'role',
        name: ENUM_MENU_NAME_SYS['角色管理'],
        meta: { label: '角色管理' },
        component: () => import('@/views/sys/roleMgr.vue')
      },
      {
        path: 'auth',
        name: ENUM_MENU_NAME_SYS['权限管理'],
        meta: { label: '权限管理' },
        component: () => import('@/views/sys/authMgr.vue')
      },
      {
        path: 'org',
        meta: { label: '组织管理' },
        children: [
          {
            path: 'orgMgr',
            name: 'orgMgr',
            meta: { label: '组织管理' },
            component: () => import('@/views/sys/orgMgr.vue')
          },
          {
            path: 'orgTypeMgr',
            name: 'orgTypeMgr',
            meta: { label: '组织类型' },
            component: () => import('@/views/sys/orgTypeMgr.vue')
          }
        ]
      },
      {
        path: 'dict',
        name: ENUM_MENU_NAME_SYS['字典管理'],
        meta: { label: '字典管理' },
        component: () => import('@/views/sys/dictMgr.vue')
      }
    ]
  },
  {
    path: 'file',
    meta: { label: '文件管理' },
    children: [
      {
        path: 'check',
        name: ENUM_MENU_NAME_FILE['文件审核'],
        meta: { label: '文件审核' },
        component: () => import('@/views/file/fileCheck.vue')
      },
      {
        path: 'channel',
        name: ENUM_MENU_NAME_FILE['文件渠道'],
        meta: { label: '文件渠道' },
        component: () => import('@/views/file/fileChannel.vue')
      },
      {
        path: 'config',
        name: ENUM_MENU_NAME_FILE['文件配置'],
        meta: { label: '文件配置', hideMenu: true },
        component: () => import('@/views/file/fileConfig.vue')
      }
    ]
  },
  {
    path: 'score',
    meta: { label: '积分来源' },
    children: [
      {
        path: 'check',
        name: ENUM_MENU_NAME_SCORE['积分审核'],
        meta: { label: '积分审核' },
        component: () => import('@/views/score/scoreCheck.vue')
      },
      {
        path: 'type',
        name: ENUM_MENU_NAME_SCORE['积分来源类型'],
        meta: { label: '积分来源类型' },
        component: () => import('@/views/score/scoreType.vue')
      }
    ]
  },
  {
    path: 'task',
    meta: { label: '任务调度' },
    children: [
      {
        path: 'manage',
        name: ENUM_MENU_NAME_TASK['任务管理'],
        meta: { label: '任务管理' },
        component: () => import('@/views/task/taskMgr.vue')
      },
      {
        path: 'executor',
        name: ENUM_MENU_NAME_TASK['执行器管理'],
        meta: { label: '执行器管理' },
        component: () => import('@/views/task/executeMgr.vue')
      },
      {
        path: 'log',
        name: ENUM_MENU_NAME_TASK['调度日志'],
        meta: { label: '调度日志' },
        component: () => import('@/views/task/dispatchLog.vue')
      }
    ]
  }
]
